-- Set this variable
DECLARE @machid AS binary						
SET @machid         = ?

-- Calculated variables
DECLARE @gameid AS int						
DECLARE @jackpotIDBase AS int
DECLARE @gutsRange1 AS int
DECLARE @gutsRange2 AS int

SET @gameid         = 18
SET @jackpotIDBase  = ( @machid * 1000 ) + 10000
SET @gutsRange1     = @machid * 100
SET @gutsRange2     = @gutsRange1 + 100

delete from AUSlotsSpinTestClientData where gutsid >= @gutsRange1 and gutsid < @gutsRange2

delete from AUSlotsSpinTestSubstNoteIDToIconID where gutsid >= @gutsRange1 and gutsid < @gutsRange2

delete from AUSlotsSpinTestExpectedResults where gutsid >= @gutsRange1 and gutsid < @gutsRange2

delete from AUSlotsProbabilityTables where gutsid >= @gutsRange1 and gutsid < @gutsRange2

delete from AUSlotsWheelStops where gamenum in ( select gamenum from AUSlotsGameData where machid = @machid )

delete from AUSlotsWheelView where gamenum in ( select gamenum from AUSlotsGameData where machid = @machid )

delete from AUSlotsLineResults where gamenum in ( select gamenum from AUSlotsGameData where machid = @machid )

delete from AUSlotsLineResultsNotes where gamenum in ( select gamenum from AUSlotsGameData where machid = @machid )

delete from AUSlotsSavedGames where gamenum in ( select gamenum from AUSlotsGameData where machid = @machid )

delete from AUSlotsScatterResults where gamenum in ( select gamenum from AUSlotsGameData where machid = @machid )

delete from AUSlotsScatterResultsNotes where gamenum in ( select gamenum from AUSlotsGameData where machid = @machid )

delete from AUSlotsBonusGames where gamenum in ( select gamenum from AUSlotsGameData where machid = @machid )

delete from AUSlotsBonusGamesNotes where gamenum in ( select gamenum from AUSlotsGameData where machid = @machid )

delete from AUSlotsGameData where machid = @machid

delete from AUSlotsgutsreels where gutsid >= @gutsRange1 and gutsid < @gutsRange2

delete from AUSlotsgutspayouts where gutsid >= @gutsRange1 and gutsid < @gutsRange2

delete from AUSlotsgutspaylines where gutsid >= @gutsRange1 and gutsid < @gutsRange2

delete from AUSlotsNotesLookup where machid = @machid

delete from AUSlotsBonusGameTypes where gutsid >= @gutsRange1 and gutsid < @gutsRange2

delete from AUSlotsgutsiconnames where gutsid >= @gutsRange1 and gutsid < @gutsRange2

delete from AUSlotsGutsMachineCombinations where gutsid >= @gutsRange1 and gutsid < @gutsRange2

delete from AUslotsguts where gutsid >= @gutsRange1 and gutsid < @gutsRange2

delete from GameDenominations where gameid = @gameid and machid = @machid

delete from AUSlotsGameModes where machid = @machid

delete from AUSlotsOptions where machid = @machid

delete from ProgressivesJackpots where jackpotID = @jackpotIDBase

delete from Progressives where jackpotID = @jackpotIDBase

delete from MachineClassLimits where gameID = @gameid and machID = @machid

delete from PlayerGameStats where gameID = @gameid and machID = @machid

delete from CasinoGameStats where gameID = @gameid and machID = @machid

delete from GAMEIDs where gameid = @gameid and machid = @machid

delete from AUSlotsSubGameData where machID = @machid

delete from AUslotmachines where machid = @machid
